<?php
/*
  $Id: header.php,v 1.42 2003/06/10 18:20:38 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/
require(DIR_WS_INCLUDES . 'javascript/' . FILENAME_INCLUDE_JAVASCRIPT_OKKO);
// check if the 'install' directory exists, and warn of its existence
  if (WARN_INSTALL_EXISTENCE == 'true') {
    if (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/install')) {
      $messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning');
    }
  }

// check if the configure.php file is writeable
  if (WARN_CONFIG_WRITEABLE == 'true') {
    if ( (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) && (is_writeable(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) ) {
      $messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning');
    }
  }

// check if the session folder is writeable
  if (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') {
    if (STORE_SESSIONS == '') {
      if (!is_dir(tep_session_save_path())) {
        $messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning');
      } elseif (!is_writeable(tep_session_save_path())) {
        $messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning');
      }
    }
  }

// check session.auto_start is disabled
  if ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) {
    if (ini_get('session.auto_start') == '1') {
      $messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning');
    }
  }

  if ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) {
    if (!is_dir(DIR_FS_DOWNLOAD)) {
      $messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning');
    }
  }

  if ($messageStack->size('header') > 0) {
    echo $messageStack->output('header');
  }
?>

<!-- start -->
<table cellspacing="0" cellpadding="0" border="0" style="width:<?=WEBSITE_WIDTH?>" align="center"> 
	<tr>
		<td width="<?=WEBSITE_WIDTH?>" height="145" class="header">
			<table cellspacing="0" cellpadding="0" border="0" >
				<tr>
					<td height="85" width="140"><br style="line-height:24px">
						<a href="<?=tep_href_link('index.php')?>"><?=tep_image(DIR_WS_IMAGES.'logo.gif')?></a><br></td>
					<td width="1" height="85"></td>
					<td width="400" height="85" align="left" style="color:#16387C">
					<!-- begin : Vunh add login and register link -->
							<br style="line-height:59px">
							<?php 
							if (!tep_session_is_registered('customer_id')) {
							?>
								Ch&agrave;o b&#7841;n ! Xin m&#7901;i <?php echo '<a style="color:#7CB900" href="' . tep_href_link('account.php') . '">' . '&#272;&#259;ng nh&#7853;p' . '</a>'; ?> ho&#7863;c <?php echo '<a  style="color:#7CB900" href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . '&#272;&#259;ng k&yacute;' . '</a>'; ?> th&agrave;nh vi&ecirc;n
							<?php } 
							else {
							?>
								Ch&agrave;o <?php global $customer_first_name; echo $customer_first_name;?> ! <?php echo '<a style="color:#7CB900" href="' . tep_href_link('logoff.php') . '">' . 'Tho&aacute;t' . '</a>'; ?>
							<?php } ?>

					<!-- begin : Vunh remmed to remove currencies select
						<br style="line-height:24px">
						<?=BOX_HEADING_CURRENCIES?>:<br>
						<br style="line-height:13px"><?php
    echo tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get');
    reset($currencies->currencies);
    $currencies_array = array();
    while (list($key, $value) = each($currencies->currencies)) {
      $currencies_array[] = array('id' => $key, 'text' => $value['title']);
    }
    $hidden_get_variables = '';
    reset($HTTP_GET_VARS);
    while (list($key, $value) = each($HTTP_GET_VARS)) {
      if ( ($key != 'currency') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) {
        $hidden_get_variables .= tep_draw_hidden_field($key, $value);
      }
    }
    echo tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" class="jamp"') . $hidden_get_variables . tep_hide_session_id();
    echo '</form>';
?> end : Vunh remmed to remove currencies select  --></td>
					<!-- begin : Vunh remmed <td width="1" height="85"><?=tep_image(DIR_WS_IMAGES.'li.gif')?> <br></td>end : Vunh remmed -->
					<td width="20" height="85"></td>
					<td width="100" height="85">						
						<!-- begin : Vunh remmed to remove language select 
						<br style="line-height:26px">
						<?=BOX_HEADING_LANGUAGES?>:<br>
						<br style="line-height:11px">
						<?php
 if (!isset($lng) || (isset($lng) && !is_object($lng))) {
 include(DIR_WS_CLASSES . 'language.php');
 $lng = new language;
 }
 $languages_string = '';
 reset($lng->catalog_languages);
 while (list($key, $value) = each($lng->catalog_languages)) {
 $languages_string .= '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type) . '">' . tep_image(DIR_WS_LANGUAGES . $value['directory'] . '/images/' . $value['image'], $value['name']) . '</a>'.tep_draw_separator('spacer.gif', '10', '1');
 }
 echo $languages_string;
?><br> end : Vunh remmed to remove language select -->
					</td>
					<td width="1" height="85"><!-- begin : Vunh remmed <?=tep_image(DIR_WS_IMAGES.'li.gif')?> end : Vunh remmed --><br></td>
					<td width="48" height="85"></td>
					<td width="25" height="85"><br style="line-height:24px">
						<a href="<?=tep_href_link('shopping_cart.php')?>"><?=tep_image(DIR_WS_IMAGES.'z1.gif')?></a><br></td>
					<td width="72" height="85">
						<br style="line-height:26px">
						<strong><?=BOX_HEADING_SHOPPING_CART?>:</strong><br>
						<br style="line-height:1px">
						<strong><a href="<?=tep_href_link('shopping_cart.php')?>"><?=$cart->count_contents()?> <?=BOX_SHOPPING_CART_EMPTY?></a></strong><br>
					</td>
				</tr>
				<!-- begin : Vunh added search module -->
				<tr>
					<td width="width:<?=WEBSITE_WIDTH?>" colspan="9">
						<table border="0">
							<?php require(DIR_WS_BOXES . 'search.php');?>
						</table>
					</td>
				</tr>
				<!-- end : Vunh added search module -->
				<tr>
					<td width="<?=WEBSITE_WIDTH?>" height="47" colspan="9" align="center">									
						<a href="<?=tep_href_link('index.php')?>"><?php echo Tep_Image_Button('m1.gif')?></a><a href="<?=tep_href_link('products_new.php')?>"><?php echo Tep_Image_Button('m2.gif')?></a><a href="<?=tep_href_link('specials.php')?>"><?php echo Tep_Image_Button('m3.gif')?></a><a href="#"><?php echo Tep_Image_Button('m4.gif')?></a><a href="<?=tep_href_link('account.php')?>"><?php echo Tep_Image_Button('m5.gif')?></a><a
						href="<?=tep_href_link('contact_us.php')?>"><?php echo Tep_Image_Button('m6.gif')?></a><br>
					</td>
				</tr>
			</table>
<!-- end -->
<?php
  if (isset($HTTP_GET_VARS['error_message']) && tep_not_null($HTTP_GET_VARS['error_message'])) {
?>
<table border="1" width="100%" cellspacing="0" cellpadding="2">
  <tr class="headerError">
    <td class="headerError"><?php echo htmlspecialchars(urldecode($HTTP_GET_VARS['error_message'])); ?></td>
  </tr>
</table>
<?php
  }

  if (isset($HTTP_GET_VARS['info_message']) && tep_not_null($HTTP_GET_VARS['info_message'])) {
?>
<table border="1" width="100%" cellspacing="0" cellpadding="2">
  <tr class="headerInfo">
    <td class="headerInfo"><?php echo htmlspecialchars($HTTP_GET_VARS['info_message']); ?></td>
  </tr>
</table>
<?php
  }
?>
<!-- start -->
		</td>
	</tr>	
	<tr>
		<td width="<?=WEBSITE_WIDTH?>" height="540">

<!-- end -->	
<?php

define(MAX_DESCR_1,'60');

define(MAX_DESCR_NAME,'35');
define(MAX_DESCR_NAME_SHOPPCART,'20');
// customization for the design layout
   // how wide the boxe